﻿#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    m_node = new QRemoteObjectNode(this);
    m_node->connectToNode(QUrl("local:myrpc"));

    m_rpc = m_node->acquire<MyRPCReplica>();

    connect(m_node,&QRemoteObjectNode::error,[](){
        qDebug() << "connect error";
    });

    connect(m_rpc,&MyRPCReplica::msgFromServer,this,&Widget::onMessageFromServer);
}

Widget::~Widget()
{
}

void Widget::onMessageFromServer(const QString &msg)
{
    qDebug() << "clienA recv" << msg;
}

